package com.hzw.saas.api.msg.query;

import javax.validation.constraints.NotBlank;

import com.hzw.saas.api.msg.enums.MsgType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 *
 * </p>
 *
 * @author sonam
 * @since 2021/1/7 14:55
 */
@ApiModel("系统消息")
public class MsgSystemQuery extends MsgQuery {

    @Setter
    @Getter
    @NotBlank(message = "系统消息标题不能为空")
    @ApiModelProperty(value="消息标题")
    private String title;

    @Setter
    @Getter
    @ApiModelProperty(value = "toUserId(为空则为群发消息)")
    private String to;

    @Getter
    @ApiModelProperty(value = "固定-1", hidden = true)
    private String from = "-1";

    @Getter
    @ApiModelProperty(hidden = true)
    private int type = MsgType.SYSTEM_MSG.code();


    public static MsgSystemQuery instance(String title, String msg, String to) {
        MsgSystemQuery msgSystemQuery = new MsgSystemQuery();
        msgSystemQuery.setTitle(title);
        msgSystemQuery.setMsg(msg);
        msgSystemQuery.setTo(to);
        return msgSystemQuery;
    }

    @Override
    public MsgType getMsgType() {
        return MsgType.SYSTEM_MSG;
    }
}
